<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
    <style>
        #box1, #box2 {
            width: 500px;
            height: 500px;
            border: 2px solid yellowgreen;
            margin-bottom: 10px;
            text-align: center;
        }

        #box1 {
            font-size: 40px;
            background-color: darkgrey;
        }

        #box2 {
            font-size: 40px;
            background-color: pink;
        }

    </style>
</head>
<body>

<div id="app">
    <Student></Student>
    <Teacher></Teacher>
</div>

<script>

    // 学生组件
    let student = {
        template: `
          <div id="box1">
          <h2>学生信息</h2>
          <p>
          <p>学生姓名:{{ stuName }}</p>
          <p>学生年龄:{{ age }}</p>
          <p>学生性别:{{ sex }}</p>
          </div>
        `,
        data: function () {
            return {
                stuName: 'jack',
                age: 20,
                sex: '男'
            }
        }
    }

    // 教师组件
    let teacher = {
        template: `
          <div id="box2">
          <h2>教师信息</h2>
          <p>教师姓名:{{ teaName }}</p>
          <p>教师年龄:{{ age }}</p>
          <p>教师性别:{{ sex }}</p>
          </div>`,
        data: function () {
            return {
                teaName: 'xiaoming',
                age: 30,
                sex: '男'
            }
        }
    }

    let vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        components: {
            student,teacher
        }
    })
</script>
</body>
</html>